﻿<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">	
<ui:composition template="/pages/templates/default.xhtml">
	<ui:define name="conteudo">
		<f:view>
			<h:form id="formDocumento">
				<p:toolbar id="toolbar">
					<p:toolbarGroup id="barra" align="left">
						<p:inplace widgetVar="titulo" effectSpeed="fast"
							emptyLabel="Documento Sem Título">
							<p:inputText value="#{documentoBean.documento.titulo}"
								required="true" requiredMessage="Título é obrigatório"
								readonly="#{documentoBean.readOnly}" onblur="titulo.save()"
								update="barra" style="width:300px" />
						</p:inplace>
					</p:toolbarGroup>
					<p:toolbarGroup align="center">
						<p:commandButton title="Salvar"
							icon="ui-icon ui-icon-disk"
							actionListener="#{documentoBean.salvar}" ajax="false" />
						<p:commandButton 
							title="Resolver" ajax="false"
							icon="ui-icon ui-icon-play"
							actionListener="#{documentoBean.resolver}" update=":messages" />
						<p:commandButton title="Enviar Email"
							icon="ui-icon ui-icon-mail-closed" ajax="false"
							actionListener="#{documentoBean.enviaEmail}" update=":messages" />
					</p:toolbarGroup>
				</p:toolbar>
				<p:tabView id="viewDocs">
					<p:tab id="tabDesc" title="Descrição">
						<h:panelGrid id="descricao" columns="1" style="width:100%">
							<p:inplace emptyLabel="Descrição do documento" widgetVar="desc"
							 effectSpeed="fast">
								<p:inputTextarea id="inDesc" rows="5" style="width:100%"
									requiredMessage="Descrição é obrigatória"									
									readonly="#{documentoBean.readOnly}" required="true"
									value="#{documentoBean.documento.descricao}"
									onblur="desc.save()" />
							</p:inplace>

							<p:spacer height="40" width="40" />
						</h:panelGrid>
						<h:outputLabel for="Pchave" value="Palavras Chave : " />
						<p:inplace widgetVar="palavras" emptyLabel="ProLinear">
							<p:inputText size="50" id="Pchave"
								value="#{documentoBean.documento.palavrasChave}"
								readonly="#{documentoBean.readOnly}" />
						</p:inplace>
					</p:tab>

					<p:tab id="tabModelo" title="Modelagem">
						<p:inputTextarea id="inModelo"
							value="#{documentoBean.documento.modelo}"
							readonly="#{documentoBean.readOnly}" rows="20" style="width:100%"
							autoResize="false" />
					</p:tab>
					<p:tab id="tabResultado" title="Resultados">
						<p:inputTextarea id="inResul" rows="20"
							value="#{documentoBean.documento.resultados}" readonly="true"
							style="width:100%" autoResize="false" />
					</p:tab>

				</p:tabView>
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>
